/***************************************************************************

-------------------
    begin                : 
    copyright            : kuzkok
    email                : kuzkok at gmail.com

***************************************************************************
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*   
*   Данная программа является свободным программным обеспечением;         *
*   Вы можете распространять ее и/или модифицировать в соответствии с     *
*   GNU General Public License опубликованной Фондом свободного           *
*   программного обеспечения; используемая версия лицензии - 2 или        *
*   (по вашему выбору) любая более поздняя                                *
***************************************************************************/

#include "onlinepoint.h"

OnlinePoint::OnlinePoint(QString theTableName) :
    OnlineFeature(theTableName)
{

}

OnlinePoint::OnlinePoint(QUuid theEventID, QString theTableName) :
        OnlineFeature(theEventID, theTableName)
{
    if(objectState)
    {
        station = selectQuery->value(selectQuery->record().indexOf("station")).toDouble();
        symbolRotation = selectQuery->value(selectQuery->record().indexOf("symbolrotation")).toDouble();
        status = selectQuery->value(selectQuery->record().indexOf("status")).toString();

    }

}

OnlinePoint::buildInsertStatement()
{
    OnlineFeature::buildInsertStatement();
    insertStatementFields += ", station"
                             ", symbolrotation"
                             ", status";
    insertStatementValues += ", :station"
                             ", :symbolrotation"
                             ", :status";
}

OnlinePoint::buildUpdateStatement()
{
    OnlineFeature::buildUpdateStatement();
    updateStatement += ", station = :station"
                       ", submbolrotation = :symbolrotation"
                       ", status = :status";
}

OnlinePoint::bindQueryValues(QSqlQuery &query)
{
    OnlineFeature::bindQueryValues(query);
    query.bindValue(":station", station);
    query.bindValue(":symbolrotation", symbolRotation);
    query.bindValue(":status", status);
}
